# Build script for Linux
#
# Usage:
#   $ cd ots/test/
#   $ scons -c         # clean
#   $ scons            # build
#

# Since the validator-checker tool might handle malicious font files, all hardening options for recent g++/ld are enabled just in case.
# See http://wiki.debian.org/Hardening for details.
env = Environment(CCFLAGS = ['-O2', '-I../include', '-I../src', '-I/usr/include/freetype2', '-ggdb', '-Wall', '-W', '-Wno-unused-parameter', '-fno-strict-aliasing', '-fPIE', '-fstack-protector', '-D_FORTIFY_SOURCE=2', '-DOTS_DEBUG'], LINKFLAGS = ['-ggdb', '-Wl,-z,relro', '-Wl,-z,now', '-pie', '-lz'])
# TODO(yusukes): better to use pkg-config freetype2 --cflags
 
env.Library('../src/libots.a',
            ['../src/cff.cc',
	    '../src/cff_type2_charstring.cc',
	    '../src/cmap.cc',
	    '../src/cvt.cc',
	    '../src/fpgm.cc',
	    '../src/gasp.cc',
	    '../src/gdef.cc',
	    '../src/glyf.cc',
	    '../src/gpos.cc',
	    '../src/gsub.cc',
	    '../src/hdmx.cc',
	    '../src/head.cc',
	    '../src/hhea.cc',
	    '../src/hmtx.cc',
	    '../src/kern.cc',
	    '../src/layout.cc',
	    '../src/loca.cc',
	    '../src/ltsh.cc',
	    '../src/maxp.cc',
	    '../src/metrics.cc',
	    '../src/name.cc',
	    '../src/os2.cc',
	    '../src/ots.cc',
	    '../src/post.cc',
	    '../src/prep.cc',
	    '../src/vdmx.cc',
	    '../src/vhea.cc',
	    '../src/vmtx.cc',
	    '../src/vorg.cc'
            ])

env.Program('../test/cff_type2_charstring_test.cc', LIBS = ['ots', 'gtest_main'], LIBPATH = '../src')
env.Program('../test/layout_common_table_test.cc', LIBS = ['ots', 'gtest_main'], LIBPATH = '../src')
env.Program('../test/table_dependencies_test.cc', LIBS = ['ots', 'gtest_main'], LIBPATH = '../src')
env.Program('../test/ot-sanitise.cc', LIBS = ['ots'], LIBPATH='../src')
env.Program('../test/idempotent.cc', LIBS = ['ots', 'freetype', 'z', 'm'], LIBPATH='../src')
env.Program('../test/perf.cc', LIBS = ['ots'], LIBPATH='../src')

# TODO(yusukes): better to use pkg-config freetype2 --libs
env.Program('../test/side-by-side.cc', LIBS = ['ots', 'freetype', 'z', 'm'], LIBPATH = '../src')
env.Program('../test/validator-checker.cc', LIBS = ['ots', 'freetype', 'z', 'm'], LIBPATH = '../src')
